/*
    File:       OSCond.h

    Contains:   A simple condition variable abstraction
    
    
        

*/

#ifndef _OSCOND_H_
#define _OSCOND_H_

#ifndef __Win32__
    #if __PTHREADS_MUTEXES__
        #include <pthread.h>
    #else
        //#include "mycondition.h"
    #endif
#endif

#include "OSMutex.h"
#include "MyAssert.h"
#include "OS.h"

class OSCond 
{
    public:

        OSCond();
        ~OSCond();
        
        void     Signal();
        void     Wait(OSMutex* inMutex, Int32 inTimeoutInMilSecs = 0);
        void     Broadcast();

  private:
#ifdef __Win32__
        HANDLE              fCondition;
        UInt32              fWaitCount;
#elif __PTHREADS_MUTEXES__
        pthread_cond_t      fCondition;
        void                TimedWait(OSMutex* inMutex, Int32 inTimeoutInMilSecs);
#endif
};



#endif //_OSCOND_H_
